<?php
include_once('global.php');
if($action->_islogin())					//检测是否判断
{
	header('Location:login.php');
	exit();
}
//编辑读者
if(isset($_GET['action']) && $_GET['action'] == 'edit')
{
	$title = '读者管理&gt;&gt;编辑读者';
	$edit  = $_GET['id'];
	//读取所有用户等级
	$rank = $member->_read_type();
	//读取这个用户的信息
	$user_info = $member->_read_a_member($_GET['id']);
}
else if(isset($_GET['action']) && $_GET['action'] == 'class')
{
	$title = '读者管理&gt;&gt;读者类别管理';
	//读取所有读者分类
	$reader_class = $member->reader_class();
	$class = 1;
}
else if(isset($_POST['search_member_btn']))
{
	$keywords = trim($_POST['search_member']);
	$title = '读者管理&gt;&gt;&nbsp;搜索<font color="orange">『' . trim($_POST['search_member']) . '』</font>&nbsp;读者列表';
	$list  = $member->_read_member_search(trim($_POST['search_member']));
}
else if(isset($_GET['action']) && $_GET['action'] == 'add')
{
	$title = '读者管理&gt;&gt;添加读者';
	$add   = 1;
	$reader_class = $member->reader_class();
}
else
{
	$list = $member->_read_member();		//读取读者
	$title = '读者管理&gt;&gt;所有读者列表';
}
//添加用户
if(isset($_POST['sub_add_member']))
{
	$member->_add_member($_POST);
}
//编辑用户
if(isset($_POST['member_sub']))
{
	$member->_edit_member($_POST);
}
//删除用户
if(isset($_GET['action']) && $_GET['action'] == 'del')
{
	$member->_del_member($_GET['id']);
}
//读者分类编辑
if(isset($_POST['member_class_sub']))
{
	$member->up_member_class($_POST);
}
include('templates/member_main.html');
?>